package com.zzq.order.controller;

import com.zzq.common.core.web.controller.SuperController;
import com.zzq.common.core.web.domain.AjaxResult;
import com.zzq.order.domain.MyOrder;
import com.zzq.order.service.impl.OrderServiceImpl;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequiredArgsConstructor
@RequestMapping("/order")
public class OrderController extends SuperController {

    private final OrderServiceImpl orderService;

    @GetMapping("/hello")
    public AjaxResult hello() {
        return AjaxResult.success("hello");
    }

    @PostMapping("/add")
    public AjaxResult add(@RequestBody @Validated MyOrder myOrder) {
        return success(orderService.insertOrder(myOrder));
    }
}
